hvmloader: Fix 22383:cba667fb80cf iterating over defns 0..255
authorKeir Fraser <keir@xen.org>
Wed, 10 Nov 2010 14:15:23 +0000 (14:15 +0000)
committerKeir Fraser <keir@xen.org>
Wed, 10 Nov 2010 14:15:23 +0000 (14:15 +0000)
We need to declare devfn as wider than 8 bits for a loop 0<devfn<256
to terminate.

Signed-off-by: Keir Fraser <keir@xen.org>
tools/firmware/hvmloader/hvmloader.c

index 893d5dc5a3ada35cf64f990036a7de215ddf4bde..5ba71f6217bc12334006b78ffe342211fdd243a9 100644 (file)
@@ -470,8 +470,7 @@ static int scan_option_rom(
  */
 static int scan_etherboot_nic(uint32_t copy_rom_dest)
 {
-    uint8_t devfn;
-    uint16_t class, vendor_id, device_id;
+    uint16_t class, vendor_id, device_id, devfn;
     int rom_size = 0;
 
     for ( devfn = 0; (devfn < 256) && !rom_size; devfn++ )
@@ -498,8 +497,7 @@ static int scan_etherboot_nic(uint32_t copy_rom_dest)
 static int pci_load_option_roms(uint32_t rom_base_addr)
 {
     uint32_t option_rom_addr, rom_phys_addr = rom_base_addr;
-    uint16_t vendor_id, device_id;
-    uint8_t devfn, class;
+    uint16_t vendor_id, device_id, devfn, class;
 
     for ( devfn = 0; devfn < 256; devfn++ )
     {